home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / Syn Text Editor 2.1.0.46 / synsetup-2.1.0.46.exe / {app} / scripts / cmnfunc.js < prev    next >
Text File  |  2003-08-13  |  4KB  |  148 lines

  1. /*
  2.   syn
  3.   Copyright (C) 2000-2003, Ascher Stefan. All rights reserved.
  4.   stievie@utanet.at, http://web.utanet.at/ascherst/
  5.  
  6.   The contents of this file are subject to the Mozilla Public License
  7.   Version 1.1 (the "License"); you may not use this file except in compliance
  8.   with the License. You may obtain a copy of the License at
  9.   http://www.mozilla.org/MPL/
  10.  
  11.   Software distributed under the License is distributed on an "AS IS" basis,
  12.   WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
  13.   the specific language governing rights and limitations under the License.
  14.  
  15.   The Original Code is cmnfunc.js, released Wed, 22 May 2002 10:37:17 UTC.
  16.  
  17.   The Initial Developer of the Original Code is Ascher Stefan.
  18.   Portions created by Ascher Stefan are Copyright (C) 2000-2003 Ascher Stefan.
  19.   All Rights Reserved.
  20.  
  21.   Contributor(s): .
  22.  
  23.   Alternatively, the contents of this file may be used under the terms of the
  24.   GNU General Public License Version 2 or later (the "GPL"), in which case
  25.   the provisions of the GPL are applicable instead of those above.
  26.   If you wish to allow use of your version of this file only under the terms
  27.   of the GPL and not to allow others to use your version of this file
  28.   under the MPL, indicate your decision by deleting the provisions above and
  29.   replace them with the notice and other provisions required by the GPL.
  30.   If you do not delete the provisions above, a recipient may use your version
  31.   of this file under either the MPL or the GPL.
  32.  
  33.   You may retrieve the latest version of this file at the syn home page,
  34.   located at http://syn.sourceforge.net/
  35.  
  36.  $Id: cmnfunc.js,v 1.2.2.5 2003/08/13 00:38:45 neum Exp $
  37. */
  38.  
  39. function InputBox(cap, prompt, txt)
  40. {
  41.   // No InputBox in JavaScript I think :-(
  42.   var dlg = Create('TForm', Self);
  43.   with (dlg) {
  44.     Caption = cap;
  45.     Position = 'poOwnerFormCenter';
  46.     BorderStyle = "bsDialog"
  47.     Height = 130;
  48.   }
  49.   with (Create('TLabel', dlg)) {
  50.     Parent = dlg;
  51.     AutoSize = false;
  52.     WordWrap = true;
  53.     Caption = prompt;
  54.     Left = 10;
  55.     Top = 10;
  56.     Width = 210;
  57.     Height = 60;
  58.   }
  59.   var ed = Create('TEdit', dlg);
  60.   with (ed) {
  61.     Text = txt;
  62.     Parent = dlg;
  63.     Left = 10;
  64.     Top = 75;
  65.     Width = 295;
  66.   }
  67.   with (Create('TButton', dlg)) {
  68.     Parent = dlg;
  69.     Caption = 'OK';
  70.     ModalResult = mrOK;
  71.     Left = 230;
  72.     Top = 10;
  73.     Default = true;
  74.   }
  75.   with (Create('TButton', dlg)) {
  76.     Parent = dlg;
  77.     Caption = 'Cancel';
  78.     ModalResult = mrCancel;
  79.     Left = 230;
  80.     Top = 40;
  81.     Cancel = true;
  82.   }
  83.   if (dlg.ShowModal == mrOK) {
  84.     var t = ed.Text
  85.     dlg.Free;
  86.     return t;
  87.   } else {
  88.     dlg.Free;
  89.     return '';
  90.   }
  91. }
  92.  
  93. function InputQuery(cap, prompt, txt)
  94. {
  95.   // Similar to InputBox, but it returns FALSE on Cancel, and the Text is in txt
  96.   var dlg = Create('TForm', Self);
  97.   with (dlg) {
  98.     Caption = cap;
  99.     Position = 'poOwnerFormCenter';
  100.     BorderStyle = "bsDialog"
  101.     Height = 130;
  102.   }
  103.   with (Create('TLabel', dlg)) {
  104.     Parent = dlg;
  105.     AutoSize = false;
  106.     WordWrap = true;
  107.     Caption = prompt;
  108.     Left = 10;
  109.     Top = 10;
  110.     Width = 210;
  111.     Height = 60;
  112.   }
  113.   var ed = Create('TEdit', dlg);
  114.   with (ed) {
  115.     Text = txt;
  116.     Parent = dlg;
  117.     Left = 10;
  118.     Top = 75;
  119.     Width = 295;
  120.   }
  121.   with (Create('TButton', dlg)) {
  122.     Parent = dlg;
  123.     Caption = 'OK';
  124.     ModalResult = mrOK;
  125.     Left = 230;
  126.     Top = 10;
  127.     Default = true;
  128.   }
  129.   with (Create('TButton', dlg)) {
  130.     Parent = dlg;
  131.     Caption = 'Cancel';
  132.     ModalResult = mrCancel;
  133.     Left = 230;
  134.     Top = 40;
  135.     Cancel = true;
  136.   }
  137.   if (dlg.ShowModal == mrOK) {
  138.     txt = ed.Text
  139.     dlg.Free;
  140.     return true;
  141.   } else {
  142.     txt = ed.Text
  143.     dlg.Free;
  144.     return false;
  145.   }
  146. }
  147.  
  148.